
package com.axc.gallery2.menu;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

import com.axc.gallery2.R;

class RootAdapter extends BaseAdapter {

    @SuppressWarnings("unused")
	private Context context; 
    public static final int[] myMemuClassId = {
            R.id.menu_location_child, R.id.menu_net_child,
            R.id.menu_camera_child, R.id.menu_edit_child, R.id.menu_more_child
            };
    public static final int[] myMemuClass = {
            R.layout.menu_location, R.layout.menu_net,
            R.layout.menu_camera, R.layout.menu_edit, R.layout.menu_more
            };
    public static final String[][] myClass = {
            {
                    "com.axc.gallery2.album.AlbumListViewActivity",
                    "com.axc.gallery2.view.GridViewActivity"
            },
            {
                    "com.axc.gallery2.net.activity.NetAlbumsActivity", "com.axc.gallery2.net.activity.NetAlbumsActivity",
                    "com.axc.gallery2.net.activity.NetAlbumsActivity"
            },
            {
                    "com.axc.gallery2.camera.activity.CameraResultactivity", "com.axc.gallery2.camera.activity.CameraResultactivity"
            },
            {
                    "com.axc.gallery2.camera.activity.CameraResultactivity", "com.axc.gallery2.camera.activity.CameraResultactivity",
                    "com.axc.gallery2.camera.activity.CameraResultactivity"
            }, {
                    "com.axc.gallery2.AboutActivity"
            }
            };
    
 

    private List<View> myViews = null;

    // private List<OnClickListener> clickListeners = null;

    public RootAdapter(Context context) {
        this.context = context;
        myViews = new ArrayList<View>();

        // clickListeners = new ArrayList<OnClickListener>();
        // 初始化菜单按钮
        for (int i = 0; i < myMemuClass.length; i++) {
            addView(i, context);
        }
    }

    @Override
    public int getCount() {
        return myMemuClass.length;
    }

    @Override
    public Object getItem(int arg0) {
        return arg0;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        return myViews.get(position);
    }

    // 初始化点击事件。
    /*
     * public void iniOnClickListener() { for (int i = 0; i <
     * myMemuClass.length; i++) { LinearLayout tempLayout=LinearLayout.g; int
     * count = count + tempLayout.getChildCount(); for(int j=0;j< count;j++)
     * clickListeners.add(new OnClickListener() {
     * @Override public void onClick(View v) { //Toast.makeText(context,
     * "dsfsdfsd", 2).show(); //System.out.println("123456"); Intent intent=new
     * Intent(); intent.setClass(context,EditActivity.class );
     * context.startActivity(intent); } }); } }
     */

    public void addView(int positsion, Context context) {
        View view = LayoutInflater.from(context)
                .inflate(myMemuClass[positsion], null);
        myViews.add(view);
    }

    /*
     * public Class<?> loadClass(string className) { Class<?> loadclass =
     * findLoadedClass(className); if (loadclass == null) { loadclass =
     * context.loadClass(className, false); if (loadclass == null) { loadclass =
     * loadClass(className); } } }
     */

}
